<script setup>
import {inject} from "vue";
import {plus} from "../../../apis/role";
import {defineProps} from "vue";
import {info} from "../../../apis/role";

const props = defineProps({
  formData:Object
})

const dialogVisible=inject('dialogVisible')
const isSuccess=inject('isSuccess')

const save = () =>{
  const { userId, roleId } = props.formData; // 解构userId和roleId
  plus({ userId, roleId }).then(()=>{
    dialogVisible.value=false
    isSuccess.value=true
  })  // 将解构出的值作为对象传递给plus函数


}

</script>
<template>

  <el-dialog :title="props.title" width="500" align-center  v-model="dialogVisible">
    <el-form>
      <el-form-item label="用户ID">
        <el-input v-model="props.formData.userId"/>
      </el-form-item>
      <el-form-item label="角色ID">
        <el-input v-model="props.formData.roleId"/>
      </el-form-item>
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button type="primary" @click="save">
          保存
        </el-button>
      </div>
    </template>
  </el-dialog>

</template>


<style scoped>

</style>